﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Liger.Web.Common;
using Liger.Web.Common.Extensions;

namespace Liger.Web.UI
{
    public class DateEditorBuilder : UIComponentBuilderBase, IHideObjectMembers
    {
        private DateEditor DateEditor
        {
            get
            {
                return this.Component as DateEditor;
            }
        }


        public DateEditorBuilder()
            : base(new DateEditor())
        {

        }

        public DateEditorBuilder(DateEditor DateEditor)
            : base(DateEditor)
        {

        }

        /// <summary>
        /// 设置属性
        /// </summary>
        /// <param name="property"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        public DateEditorBuilder Set(string property, object value)
        {
            if (this.DateEditor.Properties.ContainsKey(property))
            {
                this.DateEditor.Properties[property] = value;
            }
            else
            {
                this.DateEditor.Properties.Add(property, value);
            }
            return this;
        }

        /// <summary>
        /// 返回ligerDateEditor的Manager
        /// </summary>
        /// <param name="manager">manager的对象名</param>
        /// <returns></returns>
        public DateEditorBuilder Manager(string manager)
        {
            this.DateEditor.Manager = manager;
            return this;
        }


        public DateEditorBuilder Format(string value)
        {
            this.DateEditor.Format = value;
            return this;
        }
        public DateEditorBuilder ShowTime(bool value)
        {
            this.DateEditor.ShowTime = value;
            return this;
        }
        public DateEditorBuilder Absolute(bool value)
        {
            this.DateEditor.Absolute = value;
            return this;
        }
    }
}